# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=arch-release-promotion
pkgver=0.3.0
pkgrel=1
pkgdesc="Promote official releases with signatures and additional artifacts"
arch=(any)
url="https://gitlab.archlinux.org/archlinux/arch-release-promotion"
license=(GPL3)
depends=(
  python
  python-dotenv
  python-email-validator
  python-gitlab
  python-orjson
  python-prometheus_client
  python-pydantic
  python-pydantic-settings
  python-pyxdg
  python-torrentool
)
makedepends=(
  python-build
  python-installer
  python-pdm-backend
)
checkdepends=(python-pytest)
backup=(etc/$pkgname/projects.toml)
source=(https://gitlab.archlinux.org/archlinux/$pkgname/-/archive/$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('139d4cfbee5cc7f15909cff1537a734d785eabb10605ebfc4756f0f390f800a9')
b2sums=('e41c81eaae36c1506a08fdea6a2fcb343c45b1f6ae190ccf71fe66f2dab2adcab78be2c44263c5e8efa1d349bc18ddf1691f8fc2d097f0d074ee434d7502cc07')

build() {
  export PDM_BUILD_SCM_VERSION=$pkgver
  cd $pkgname-$pkgver
  make build
}

check() {
  cd $pkgname-$pkgver
  make test
}

package() {
  cd $pkgname-$pkgver
  DESTDIR="$pkgdir" make install
  install -vDm 644 {examples/example.toml,README.rst} -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 examples/projects.toml -t "$pkgdir/etc/$pkgname/"
  install -vDm 644 examples/systemd/*.{service,timer} -t "$pkgdir/usr/lib/systemd/system/"
  install -vDm 644 examples/sysusers.d/*.conf -t "$pkgdir/usr/lib/sysusers.d/"
}
